Repository navigation
fix(cli): take a stale sign-in lock over one run at a time; test: no random id in the #479 match - #727
Merged
Conversation
…random id in the #479 match - credential-store.js: a run takes over a stale lock only while it holds a second O_EXCL lock (<lock>.takeover), and only if the lock is still stale then. It no longer renames a lock aside, so a lock another run made since is never moved and a third run cannot get in beside it. A takeover lock of a crashed run is removed after lockStaleMs. - hardening.test.js: the #479 check leaves out the answer's random requestId, which may hold a "3". Fixes #717 Fixes #721 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…during one backs off - takeOver says whether it removed the lock; the caller waits otherwise. - A run whose new lock meets a takeover lock removes its own and waits, so a removal between the age read and the unlink never lets two in. - A takeover lock counts as crashed after 10 s, not lockStaleMs. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This was referenced Nov 22, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #717
Fixes #721
#717, the CLI's sign-in lock:
<lock>.takeover, made with O_EXCL. Holding it, the run reads the lock's age again and removes the lock only if it is still stale. Nothing renames a lock aside any more, so a lock made since is never moved.lockPollMsand gives up afterlockWaitMs, as for any held lock.LOCKED; a lock made during a takeover backs off until it ends.#721: the #479 hardening test leaves out the answer's random
requestIdbefore it looks for a "3".Places checked: docs/reference/cli.md (the lock's description still holds), the CLI CHANGELOG.
Tests:
npm test -w pivotkit-cli, the server's hardening tests, lint, types; the lock tests 10 times in a row.🤖 Generated with Claude Code